/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package classesInterface;

import classesBancodeDados.FichaAdmissaoMedica;
import classesJpa.FichaAdmissaoMedicaJpaController;
import classesJpa.exceptions.NonexistentEntityException;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author Luke
 */
public class TelaFichaAdmisMedic4 extends javax.swing.JFrame {

    /**
     * Creates new form AdmisMedic4
     */
    private TelaFichaAdmisMedic4() {
        initComponents();
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    }
    
    public static TelaFichaAdmisMedic4 getInstance(){
        if(uniqueInstance == null){
            System.out.println("Setando");
            uniqueInstance = new TelaFichaAdmisMedic4();
        }
        return uniqueInstance;
    }
    
    public void turnEditable(boolean editable){
        this.editable = editable;
        botaoSalvar.setEnabled(editable);
        campoPeso.setEditable(editable);
        campoAltura.setEditable(editable);
        campoIMC.setEditable(editable);
        campoPA.setEditable(editable);
        campoFC.setEditable(editable);
        campoFR.setEditable(editable);
        campoTemp.setEditable(editable);
        campoGeral.setEditable(editable);
        campoCabPes.setEditable(editable);
        campoGanglios.setEditable(editable);
        campoPele.setEditable(editable);
        campoACV.setEditable(editable);
        campoAR.setEditable(editable);
        campoABD.setEditable(editable);
        campoAGU.setEditable(editable);
        campoSME.setEditable(editable);
        campoSN.setEditable(editable);
        campoSumula.setEditable(editable);
        campoHipotese.setEditable(editable);
        campoDiagAlta.setEditable(editable);
        campoConduta.setEditable(editable);
    }
    
    public void limpaCampos() {
        campoABD.setText("");
        campoACV.setText("");
        campoAGU.setText("");
        campoAR.setText("");
        campoAltura.setText("");
        campoCabPes.setText("");
        campoConduta.setText("");
        campoDiagAlta.setText("");
        campoFC.setText("");
        campoFR.setText("");
        campoGanglios.setText("");
        campoGeral.setText("");
        campoHipotese.setText("");
        campoIMC.setText("");
        campoPA.setText("");
        campoPele.setText("");
        campoPeso.setText("");
        campoSME.setText("");
        campoSN.setText("");
        campoSumula.setText("");
        campoTemp.setText("");
        
    }
    
    public void preencheCampos(FichaAdmissaoMedica ficha) {
        campoABD.setText(ficha.getExameFisico().getAbd());
        campoACV.setText(ficha.getExameFisico().getAcv());
        campoAGU.setText(ficha.getExameFisico().getAgu());
        campoAR.setText(ficha.getExameFisico().getAr());
        campoAltura.setText(ficha.getExameFisico().getAltura() + "");
        campoCabPes.setText(ficha.getExameFisico().getCabecaPescoco());
        campoConduta.setText(ficha.getExameFisico().getConduta());
        campoDiagAlta.setText(ficha.getExameFisico().getDiagAlta());
        campoFC.setText(ficha.getExameFisico().getFc() + "");
        campoFR.setText(ficha.getExameFisico().getFr() + "");
        campoGanglios.setText(ficha.getExameFisico().getGanglios());
        campoGeral.setText(ficha.getExameFisico().getGeral());
        campoHipotese.setText(ficha.getExameFisico().getHipoteses());
        campoIMC.setText(ficha.getExameFisico().getImc() + "");
        campoPA.setText(ficha.getExameFisico().getPa());
        campoPele.setText(ficha.getExameFisico().getPele());
        campoPeso.setText(ficha.getExameFisico().getPeso() + "");
        campoSME.setText(ficha.getExameFisico().getSme());
        campoSN.setText(ficha.getExameFisico().getSn());
        campoSumula.setText(ficha.getExameFisico().getSumula());
        campoTemp.setText(ficha.getExameFisico().getTemp() + "");
    }

    public boolean isEditable() {
        return editable;
    }

    public void setEditable(boolean editable) {
        this.editable = editable;
    }

    public FichaAdmissaoMedica getFicha() {
        return ficha;
    }

    public void setFicha(FichaAdmissaoMedica ficha) {
        this.ficha = ficha;
    }


    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel2 = new javax.swing.JLabel();
        campoPeso = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        campoAltura = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        campoIMC = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        campoPA = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        campoFC = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        campoFR = new javax.swing.JTextField();
        campoTemp = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        campoGeral = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        campoCabPes = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        campoGanglios = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        campoPele = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        campoACV = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        campoAR = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        campoABD = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        campoAGU = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        campoSME = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        campoSN = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        campoSumula = new javax.swing.JTextArea();
        jLabel24 = new javax.swing.JLabel();
        campoHipotese = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        campoDiagAlta = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        campoConduta = new javax.swing.JTextArea();
        botaoProximo = new javax.swing.JButton();
        botaoCancelar = new javax.swing.JButton();
        botaoAnterior = new javax.swing.JButton();
        botaoSalvar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Andalus", 1, 14)); // NOI18N
        jLabel1.setText("Exame Físico");

        jLabel2.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel2.setText("Peso:");

        jLabel3.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel3.setText("Kg");

        jLabel4.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel4.setText("Altura:");

        jLabel5.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel5.setText("m");

        jLabel6.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel6.setText("IMC:");

        jLabel7.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel7.setText("PA:");

        jLabel8.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel8.setText("mmHg");

        jLabel9.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel9.setText("FC:");

        jLabel10.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel10.setText("FR:");

        jLabel11.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel11.setText("Temperatura:");

        jLabel12.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel12.setText("ºC");

        jLabel13.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel13.setText("Geral:");

        jLabel14.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel14.setText("Cabeça e Pescoço (ORF e Otoscopia):");

        jLabel15.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel15.setText("Gânglios:");

        jLabel16.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel16.setText("Pele:");

        jLabel17.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel17.setText("ACV:");

        jLabel18.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel18.setText("AR:");

        jLabel19.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel19.setText("ABD:");

        jLabel20.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel20.setText("AGU:");

        jLabel21.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel21.setText("SME:");

        jLabel22.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel22.setText("SN:");

        jLabel23.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel23.setText("Súmula Psicopatológica:");

        campoSumula.setColumns(20);
        campoSumula.setRows(5);
        jScrollPane1.setViewportView(campoSumula);

        jLabel24.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel24.setText("Hipóteses Diagnósticas:");

        jLabel25.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel25.setText("Diagnóstico de Alta:");

        jLabel26.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel26.setText("Conduta:");

        campoConduta.setColumns(20);
        campoConduta.setRows(5);
        jScrollPane2.setViewportView(campoConduta);

        botaoProximo.setText("Próximo >");
        botaoProximo.setEnabled(false);

        botaoCancelar.setText("Cancelar");
        botaoCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoCancelarActionPerformed(evt);
            }
        });

        botaoAnterior.setText("< Anterior");
        botaoAnterior.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoAnteriorActionPerformed(evt);
            }
        });

        botaoSalvar.setText("Salvar");
        botaoSalvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoSalvarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSeparator1)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoTemp, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel12)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel13)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoGeral))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoCabPes))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoGanglios))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel16)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoPele))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel17)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoACV))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel18)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoAR))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel19)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoABD))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel20)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoAGU))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel21)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoSME))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel22)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoSN))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoPeso, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel3)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoAltura, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel5)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoIMC, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoPA, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel8)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoFC, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoFR, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel23)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane1))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel24)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoHipotese))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel25)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoDiagAlta))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel26)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane2))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jLabel1))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(botaoSalvar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(botaoAnterior)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(botaoCancelar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(botaoProximo)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(campoPeso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4)
                    .addComponent(campoAltura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(campoIMC, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7)
                    .addComponent(campoPA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9)
                    .addComponent(campoFC, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10)
                    .addComponent(campoFR, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(campoTemp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12)
                    .addComponent(jLabel13)
                    .addComponent(campoGeral, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(campoCabPes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(campoGanglios, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(campoPele, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(campoACV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(campoAR, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(campoABD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20)
                    .addComponent(campoAGU, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(campoSME, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel22)
                    .addComponent(campoSN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel23)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel24)
                    .addComponent(campoHipotese, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel25)
                    .addComponent(campoDiagAlta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel26)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(botaoProximo)
                    .addComponent(botaoCancelar)
                    .addComponent(botaoAnterior)
                    .addComponent(botaoSalvar))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void botaoAnteriorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoAnteriorActionPerformed
        this.setVisible(false);
        TelaFichaAdmisMedic3.getInstance().setVisible(true);
    }//GEN-LAST:event_botaoAnteriorActionPerformed

    private void botaoCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoCancelarActionPerformed
        TelaFichaAdmisMedic1.getInstance().limpaCampos();
        TelaFichaAdmisMedic2.getInstance().limpaCampos();
        TelaFichaAdmisMedic3.getInstance().limpaCampos();
        TelaFichaAdmisMedic4.getInstance().limpaCampos();
        this.setVisible(false);
    }//GEN-LAST:event_botaoCancelarActionPerformed

    private void botaoSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoSalvarActionPerformed
        FichaAdmissaoMedicaJpaController jpa = new FichaAdmissaoMedicaJpaController();
        ficha.getExameFisico().setAbd(campoABD.getText());
        ficha.getExameFisico().setAcv(campoACV.getText());
        ficha.getExameFisico().setAgu(campoAGU.getText());
        ficha.getExameFisico().setAltura(Double.parseDouble(campoAltura.getText()));
        ficha.getExameFisico().setAr(campoAR.getText());
        ficha.getExameFisico().setCabecaPescoco(campoCabPes.getText());
        ficha.getExameFisico().setConduta(campoConduta.getText());
        ficha.getExameFisico().setDiagAlta(campoDiagAlta.getText());
        ficha.getExameFisico().setFc(Double.parseDouble(campoFC.getText()));
        ficha.getExameFisico().setFr(Double.parseDouble(campoFR.getText()));
        ficha.getExameFisico().setGanglios(campoGanglios.getText());
        ficha.getExameFisico().setGeral(campoGeral.getText());
        ficha.getExameFisico().setHipoteses(campoHipotese.getText());
        ficha.getExameFisico().setImc(Double.parseDouble(campoIMC.getText()));
        ficha.getExameFisico().setPa(campoPA.getText());
        ficha.getExameFisico().setPele(campoPele.getText());
        ficha.getExameFisico().setPeso(Double.parseDouble(campoPeso.getText()));
        ficha.getExameFisico().setSme(campoSME.getText());
        ficha.getExameFisico().setSn(campoSN.getText());
        ficha.getExameFisico().setSumula(campoSumula.getText());
        ficha.getExameFisico().setTemp(Double.parseDouble(campoTemp.getText()));
        try {
            jpa.edit(ficha);
        } catch (NonexistentEntityException ex) {
            JOptionPane.showMessageDialog(null, "Ficha não encontrada.");
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, "Erro na comunicação com o Banco de Dados.");
        }
    }//GEN-LAST:event_botaoSalvarActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        TelaFichaAdmisMedic1.getInstance().limpaCampos();
        TelaFichaAdmisMedic2.getInstance().limpaCampos();
        TelaFichaAdmisMedic3.getInstance().limpaCampos();
        TelaFichaAdmisMedic4.getInstance().limpaCampos();
        setVisible(false);
    }//GEN-LAST:event_formWindowClosing

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(TelaFichaAdmisMedic4.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(TelaFichaAdmisMedic4.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(TelaFichaAdmisMedic4.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(TelaFichaAdmisMedic4.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TelaFichaAdmisMedic4().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botaoAnterior;
    private javax.swing.JButton botaoCancelar;
    private javax.swing.JButton botaoProximo;
    private javax.swing.JButton botaoSalvar;
    private javax.swing.JTextField campoABD;
    private javax.swing.JTextField campoACV;
    private javax.swing.JTextField campoAGU;
    private javax.swing.JTextField campoAR;
    private javax.swing.JTextField campoAltura;
    private javax.swing.JTextField campoCabPes;
    private javax.swing.JTextArea campoConduta;
    private javax.swing.JTextField campoDiagAlta;
    private javax.swing.JTextField campoFC;
    private javax.swing.JTextField campoFR;
    private javax.swing.JTextField campoGanglios;
    private javax.swing.JTextField campoGeral;
    private javax.swing.JTextField campoHipotese;
    private javax.swing.JTextField campoIMC;
    private javax.swing.JTextField campoPA;
    private javax.swing.JTextField campoPele;
    private javax.swing.JTextField campoPeso;
    private javax.swing.JTextField campoSME;
    private javax.swing.JTextField campoSN;
    private javax.swing.JTextArea campoSumula;
    private javax.swing.JTextField campoTemp;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JSeparator jSeparator1;
    // End of variables declaration//GEN-END:variables
    private static TelaFichaAdmisMedic4 uniqueInstance;
    private boolean editable;
    private FichaAdmissaoMedica ficha;
 }
